'use strict';
const crypto = require('crypto')
module.exports = app => {
    const { STRING, INTEGER, DATE, ENUM } = app.Sequelize;
    // 配置（重要：一定要配置详细，一定要！！！）
    const Cashout = app.model.define('cashout', {
        id: {
            type: INTEGER(30).UNSIGNED,
            primaryKey: true,
            autoIncrement: true
        },
        type: {
            type: ENUM,
            values: ['shop', 'wxuser'],
            allowNull: false,
            defaultValue: 'shop',
            comment: '类型 shop商家  wxuser代理 '
        },
        type_id: {
            type: INTEGER(30),
            allowNull: false,
            defaultValue: 0,
            comment: '商家 代理 id'
        },
        content: {
            type: STRING(2000),
            allowNull: false,
            defaultValue: '0',
            comment: '内容',
        },
        price: {
            type: STRING(200),
            allowNull: false,
            defaultValue: '',
            comment: '交易金额',
        },
        fail_centent: {
            type: STRING(400),
            comment: '失败原因',
        },
        status: {
            type: ENUM,
            values: ['success', 'fail', 'wait'],
            allowNull: false,
            defaultValue: 'wait',
            comment: '状态 success成功  fail失败  wait等待',
        },
        created_at: DATE,
        updated_at: DATE,
    });
    return Cashout;
};